//
//  AspectTrackViewController.m
//  runtimeDemo
//
//  Created by admin on 2018/2/27.
//  Copyright © 2018年 admin. All rights reserved.
//

#import "AspectTrackViewController.h"
#import "NSMutableArray+SafeChecker.h"
#import "Masonry.h"
#import "UIColor+Hex.h"
#import "UIView+Frame.h"
#import "UIScreen+screenSize.h"
#import "Aspects.h"
#import "SecodViewController.h"

@interface AspectTrackViewController ()

@property (nonatomic, strong) NSMutableArray *mutableArray;
@property (nonatomic, strong) UIButton *clickButton;
@property (nonatomic, strong) UIButton *clickButton2;
@property (nonatomic, strong) UIButton *clickButton3;

@end

@implementation AspectTrackViewController

// UIViewController 的指定初始化方法，调用init方法之后还是会调用到这边
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    //    NSLog(@"Current method: %@", NSStringFromClass(_cmd));
    if (self) {
        
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.clickButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.view addSubview:self.clickButton];
    [self.clickButton mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.centerY.mas_equalTo(self.view.mas_centerY);
        make.centerX.mas_equalTo(self.view.mas_centerX);
        make.top.mas_equalTo(150);
        make.width.mas_equalTo(100);
        make.height.mas_equalTo(50);
    }];
    self.clickButton.backgroundColor = [UIColor colorWithHexString:@"#0000ff"];
    [self.clickButton addTarget:self action:@selector(buttonClicked) forControlEvents:UIControlEventTouchUpInside];
    
    self.clickButton2 = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.view addSubview:self.clickButton2];
    [self.clickButton2 mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.centerY.mas_equalTo(self.view.mas_centerY);
        make.centerX.mas_equalTo(self.view.mas_centerX);
        make.top.mas_equalTo(240);
        make.width.mas_equalTo(100);
        make.height.mas_equalTo(50);
    }];
    self.clickButton2.backgroundColor = [UIColor colorWithHexString:@"#0000ff"];
    [self.clickButton2 addTarget:self action:@selector(buttonClicked2) forControlEvents:UIControlEventTouchUpInside];
    
    self.clickButton3 = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.view addSubview:self.clickButton3];
    [self.clickButton3 mas_makeConstraints:^(MASConstraintMaker *make) {
        //        make.centerY.mas_equalTo(self.view.mas_centerY);
        make.centerX.mas_equalTo(self.view.mas_centerX);
        make.top.mas_equalTo(330);
        make.width.mas_equalTo(100);
        make.height.mas_equalTo(50);
    }];
    self.clickButton3.backgroundColor = [UIColor colorWithHexString:@"#0000ff"];
    [self.clickButton3 addTarget:self action:@selector(buttonClicked3) forControlEvents:UIControlEventTouchUpInside];
    
    // test runtime 实现数据越界的测试
//    self.mutableArray = [NSMutableArray arrayWithCapacity:0];
//    NSString *str;
//    [self.mutableArray addObject:@"lois"];
//        [self.mutableArray addObject:str];
//        [self.mutableArray addObject:@"levi"];
    
}

- (void)buttonClicked {
    SecodViewController *secondVC = [[SecodViewController alloc] init];
    [self.navigationController pushViewController:secondVC animated:YES];
}

- (void)buttonClicked2 {
    
}

- (void)buttonClicked3 {
    
}


@end
